package com.edu.service.impl;

import com.edu.bean.Admin;
import com.edu.dao.AdminDao;
import com.edu.dao.impl.AdminDaoImpl;
import com.edu.service.AdminService;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author:xgdxqr
 * @Date:2025/9/19-13:21-54
 **/

public class AdminServiceImpl implements AdminService {
    private AdminDao adminDao = new AdminDaoImpl();
    @Override
    public Map<String, Object> login(String account, String password) {
        Map<String,Object> adminMap = new HashMap();
        Admin admin = adminDao.selectAdmin(account,password);
        if(admin!=null){
            adminMap.put("admin",admin);
        }else {
            admin = adminDao.selectAdminByAccount(account);
            if(admin==null){
                adminMap.put("errorLogin","账号不存在");
            }else{
                adminMap.put("errorLogin","密码错误");
            }
        }
        return adminMap;
    }
}
